<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div::before{
            /* 必须写content属性  否则无效 */
            content: '我';
            /* 属于行内元素  所以要转化为行内块元素才能设置宽高  */
            display: inline-block;
            width: 40px;
            height: 40px;
            background-color: gray;
        }
        div::after {
            content: '猪';
        }
    </style>
</head>

<body>
    <div>
        是
    </div>
</body>

</html>